package BookStore.dao;

import BookStore.model.Book_a_1;
import BookStore.util.VDbUtil;

import javax.swing.*;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class Book_aDao {
    private Book_a_1 book_a_1;

    public Book_aDao(Book_a_1 temp_a_1) {
        this.book_a_1 = temp_a_1;
    }

    public void alter() throws Exception {
        Connection con_2_2 = VDbUtil.getCon_2_2();
        String sql_1 = "update BOOK set  name = '"+book_a_1.getBookName_2()+"', aulthor  = '"+book_a_1.getBookAulthor_2()+"',price = '"+book_a_1.getBookPrice_2()+"',kind = '"+book_a_1.getBookKind_2()+"',press = '"+book_a_1.getBookPress_2()+"' where id = '"+book_a_1.getBookId_2()+"'";
        PreparedStatement ps_2 = con_2_2.prepareStatement(sql_1);
        ResultSet alt = ps_2.executeQuery();
        JOptionPane.showMessageDialog(null,"书籍修改成功");

        con_2_2.close();
        ps_2.close();
    }
}